package com.softer.wxzj.common.util;

import com.softer.wxzj.entity.SysUser;
import org.apache.shiro.SecurityUtils;

/**
 * ShiroUser class
 * @desc shiro中用户主体信息
 * @author zcz
 * @date 2019/1/16
 */
public class ShiroUser {
    /**
     * 获取用户主体
     * @return
     */
    public static SysUser getUser(){
        return (SysUser) SecurityUtils.getSubject().getPrincipal();
    }

    /**
     * 获取用户名
     * @return
     */
    public static String getUserName(){
        SysUser u = (SysUser) SecurityUtils.getSubject().getPrincipal();
        return u.getUserName();
    }
}
